package com.rpay.model.admin;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.List;
import javax.persistence.*;

@Setter
@Getter
@Table(name = "rpay_admin_user")
public class RpayAdminUser {
    @Id
    private Long id;
//    private Long userId;

    /**
     * 账号
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 姓名
     */
    @Column(name = "real_name")
    private String realName;

    /**
     * 联系人
     */
    private String contact;

    /**
     * 电话
     */
    private String phone;

    /**
     * 人员类型
     */
    @Column(name = "user_type")
    private Short userType;

    /**
     * 经度
     */
    private String longitude;

    /**
     * 纬度
     */
    private String latitude;

    /**
     * 省份编码
     */
    @Column(name = "province_code")
    private String provinceCode;

    /**
     * 省份名称
     */
    @Column(name = "province_name")
    private String provinceName;

    /**
     * 城市编码
     */
    @Column(name = "city_code")
    private String cityCode;

    /**
     * 城市名称
     */
    @Column(name = "city_name")
    private String cityName;

    /**
     * 区县编码
     */
    @Column(name = "area_code")
    private String areaCode;

    /**
     * 区县名称
     */
    @Column(name = "area_name")
    private String areaName;

    /**
     * 详细地址
     */
    @Column(name = "address_detail")
    private String addressDetail;

    /**
     * 所属机构id
     */
    @Column(name = "org_id")
    private Long orgId;

    /**
     * 所属机构父id
     */
    @Column(name = "parent_org_id")
    private Long parentOrgId;

    /**
     * 状态:1-正常，2-冻结
     */
    private Short status;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "created_time")
    private Date createdTime;

    @Column(name = "last_login_time")
    private Date lastLoginTime;

    @Column(name = "last_login_ip")
    private String lastLoginIp;

    private String remark;

    /**
     * 返利总额，以分为单位
     */
    @Column(name = "rebate_money")
    private Long rebateMoney;

    /**
     * 用户编号
     */
    @Column(name = "user_no")
    private String userNo;


    @Transient
    private Long roleId;

    @Transient
    private List<String> modulecode;

    public RpayAdminUser() {

    }

    public RpayAdminUser(RpayAdminUser user) {
        this.username = user.getUsername();
        this.password = user.getPassword();
        this.createdTime = user.getCreatedTime();
        this.realName = user.getRealName();
        this.phone = user.getPhone();
        this.id = user.getId();
        this.status = user.getStatus();
        this.userType = user.getUserType();
    }
}